This page last changed on Nov 16, 2005 by rossmason.

If you have multiple Jms clients with different connection credentials you can pass in credentials as part of the jms endpoint Uri i.e.

jms://ross:[email protected]?createConnector=ALWAYS

You should also specify that a new connection should be created for this endpoint so that mule does not try and reuse an existing Jms Connector. A new connector will be created using the 'ross' as the user and 'secret' as the password and a destination called 'data.queue' will be obtained.

In order for this to work we need to tell Mule more information about creating the connector such as the Jms 'jndiInitialFactory' or 'connectionFactory' to use. Default values for these properties can be set on the MuleManager or MuleClient before making a connection. The properties themselves are set using the name of the property for the connector prepended by the connector protocol.

MuleClient client = new MuleClient();
client.setProperty("jms.connectionFactoryJndiName", "ConnectionFactory");
client.setProperty("jms.jndiInitialFactory",
     "org.codehaus.activemq.jndi.ActiveMQInitialContextFactory");
client.setProperty("jms.specification", "1.1");

client.dispatch("jms://admin:[email protected]?createConnector=ALWAYS", "dummy message", null);

The example above shows how to set default Jms connector values for connectionFactoryJndiName, jndiInitialFactory and specification. These will be used when creating a new Jms connector and the connection itself will be created using 'admin' and 'admin' for user and password.

Document generated by Confluence on Nov 27, 2006 10:27